package routines;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

@Entity
@Table(name = "budgets")
public class Budget {
	
	private Long id;
	private String code;
	private String name;
	private CustomerInfo customerinfo; 
	
	
	public Budget(){};
	
	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "customerinfo_id", nullable = false)
	public CustomerInfo getCustomerinfo() {
		return customerinfo;
	}

	public void setCustomerinfo(CustomerInfo customerinfo) {
		this.customerinfo = customerinfo;
	}

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO, generator = "seq_budgets_gen")
	@SequenceGenerator(name = "seq_budgets_gen", sequenceName = "seq_budgets")
	@Column(name = "budget_id")
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Budget(String code, String name) {
		this.code = code;
		this.name = name;
	}

	@Column(name = "code",columnDefinition = "TEXT")
	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	@Column(name = "name", columnDefinition = "TEXT")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	

}
